package com.example.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Service;

/**
 * 本文来演示
 *
 * @author 赵建云
 * @create 2023/10/12
 */
@Service
public class SendEmailServiceImpl implements SendEmailService{
    private String from="1804701808@qq.com";
    @Autowired
    private JavaMailSender mailSender;
    @Override
    public void sendEmail(String to,String subject,String content) {
        SimpleMailMessage message = new SimpleMailMessage();
        //邮件发送人
        message.setFrom(from);
        //邮件接收人
        message.setTo(to);
        //邮件主题
        message.setSubject(subject);
        //邮件内容
        message.setText(content);
        System.out.println("=====");
        //发送邮件
        mailSender.send(message);

    }
}
